<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<link rel="stylesheet" href="${pageContext.request.contextPath}/cts/css/im.css" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/im.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/cts/js/imPopdiv.js"></script>

<div id="popdiv_outter_im" class="popdiv_outter_im"></div>
<div id='imBar' class="imBarDiv" style="text-align: center;" onselectstart="return false">
	<div id='imBarNearest' class="imBarDivDetail">
		<div class="imDetailTopDiv">
			<div class="imDetailTopLeft">&nbsp;&nbsp;价格往来</div><div class="imDetailTopRight" onclick="hideImBarDiv('imBarNearest')">&nbsp;</div>
		</div>
		<div id='imBarNearestContent'></div>
	</div>
	<div id='imBarDetail' class="imBarDivDetail">
		<div class="imDetailTopDiv">
			<div class="imDetailTopLeft">&nbsp;&nbsp;我的联系人</div><div class="imDetailTopRight" onclick="hideImBarDiv('imBarDetail')">&nbsp;</div>
		</div>
			<div id='imBarDetailContent'></div>
	</div>
	<div id='imSysNote' class="imBarDivDetail">
		<div class="imDetailTopDiv">
			<div class="imDetailTopLeft">&nbsp;&nbsp;系统通知</div><div class="imDetailTopRight" onclick="hideImBarDiv('imSysNote')">&nbsp;</div>
		</div>
			<div id='imSysNoteContent'></div>
	</div>
	<div id='imCSDetail' class="imBarDivDetail">
		<div class="imDetailTopDiv">
			<div class="imDetailTopLeft">&nbsp;&nbsp;客服中心</div><div class="imDetailTopRight" onclick="hideImBarDiv('imCSDetail')">&nbsp;</div>
		</div>
			<div id='imCSDetailContent'></div>
	</div>
	<div id="serverCenter" style="float:left;height:20%;"><!-- <img title="帮助中心" src="${pageContext.request.contextPath}/cts/images/serverCenter.png" style="cursor:pointer;" onclick=" openHelpCenter()"/> -->&nbsp;</div>
	<div id="msgBox" style="float:left;height:20%;margin:8px 0 0 4px;_margin:8px 0 0 3px;-moz-user-select:none;-webkit-user-select: none;"><img title="联系人" id="clientNote" src="${pageContext.request.contextPath}/cts/images/new_clientNote.png" style="cursor:pointer;"/></div>
	<div id="nearest" style="float:left;height:20%;margin:6px 0 0 7px;_margin:6px 0 0 3px;-moz-user-select:none;-webkit-user-select: none;"><img title="价格往来" id="priceTip"  src="${pageContext.request.contextPath}/cts/images/new_priceTip.png" style="cursor:pointer;"/></div>
	<div id="sysNote" style="float:left;height:20%;margin:6px 0 0 7px;_margin:6px 0 0 3px;-moz-user-select:none;-webkit-user-select: none;"><img title="系统通知" id="sysMsg" src="${pageContext.request.contextPath}/cts/images/new_systemNote.png" style="cursor:pointer;"/></div>
	<div id="newWay" style="float:left;height:20%;margin:6px 0 0 7px;_margin:6px 0 0 3px;-moz-user-select:none;-webkit-user-select: none;"><a style="border: 0;"  href='#'><img title="帮助中心" src="${pageContext.request.contextPath}/cts/images/new_newway.png" style="cursor:pointer; border: 0" /></a></div>
</div>


<div id="popdiv_outter_imChat" class="popdiv_outter"></div>
<div id="popdiv_inner_imChat" class="im_popdiv_inner" style="width: 650px; +padding-bottom: 22px; _padding-bottom: 19px;">
	<div class="im_popdiv_inner_outter"></div>
	<div class="im_popdiv_close"></div>
	<div class="im_popdiv_handle" id="popdiv_handle" title="鼠标左键按住可拖动">洽谈窗口</div>
    <div class="im_popdiv_content" id="popdiv_content" style="float: left; width: 628px; _margin: 3px; _margin-top:16px;"></div>
    </div>
</div>

<input id="switchFlagHid" type="hidden" value="<%=request.getParameter("switchFlag") %>" />
<script type="text/javascript">
		var totalCount=0;
		var totalNRFM = 0;
		var totalPrice=0;
		var pushEnq = false;
		
		imFullUrl="${pageContext.request.contextPath}";
		$(function (){
			var userId = getCookie("cts_userid");
			if(!isNaN(userId)){
				imSwitch($("#switchFlagHid").val());
			};
			setImPosition();
			setInterval(shakeHead, 1000);
		});
		
		//获取指定名称的cookie的值   
		function getCookie(objName){
			var arrStr = document.cookie.split("; ");   
			for(var i = 0;i < arrStr.length;i ++){   
			var temp = arrStr[i].split("=");    
			if(temp[0] == objName) return unescape(temp[1]);   
			} 
		}
		
		//新手上路
		function openNewWay(){
			window.open("${pageContext.request.contextPath}/cts/newway.action");
		}
		//帮助中心
		function openHelpCenter(){
			window.open("${pageContext.request.contextPath}/cts/helpCenter.action");
		}
		var timer0;
		var timer3;
		function shakeHead(){
			
			// @author:freedom ; modefDate:2012.01.14
			var isIndex = '<%= request.getParameter("isindex")%>';
			if(isIndex == 'true'){
			  clearInterval(timer3);
			  clearInterval(timer0);
			  $("#imBar").hide();
			  return;
			}
			
			if(parseInt(totalCount)>0){
				var ii=1;
				timer3=setInterval(function(){
					ii++;
					if(ii%2==0){
						$(".shakeMark").css("visibility","visible");
					}else{
						$(".shakeMark").css("visibility","hidden");
					}
				}, 500);
			}else if(parseInt(totalCount)<=0){
				$("#.shakeMark").css("visibility","visible");
				clearInterval(timer3);
				timer3=null;
			}
			
			if(parseInt(totalCount)>0 && timer0==null){
				$("#clientNote").show();
				var i=1;
				timer0=setInterval(function(){
					i++;
					if(i%2==0){
						$("#clientNote").css("visibility","visible");
					}else{
						$("#clientNote").css("visibility","hidden");
					}
				}, 500);
			}else if(parseInt(totalCount)<=0){
				$("#clientNote").css("visibility","visible");
				clearInterval(timer0);
				timer0=null;
			}
			
	    }
	    
</script>
